<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>后台用户管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel='stylesheet' type='text/css' href='__PUBLIC__/css/admin-style.css' />
<script language="JavaScript" type="text/javascript" charset="utf-8" src="__PUBLIC__/js/jquery.js"></script>
<script language="JavaScript" type="text/javascript" charset="utf-8" src="__PUBLIC__/js/admin.js"></script>
<script language="JavaScript" type="text/javascript" charset="utf-8" src="__PUBLIC__/js/amcharts.js"></script>
<script language="JavaScript" type="text/javascript" charset="utf-8" src="__PUBLIC__/js/datapicker/WdatePicker.js"></script>
<!-- 
<php>echo json_encode($data);</php>
 -->
<script language="javascript">
var data = [<volist name="idata" id="d">
{
    year: new Date({$d.y}, {$d.m} - 1, {$d.d}),
    value: {$d.c}
},
</volist>
];

var chart;
var graph;

// note, some of tada points don't have value field
var chartData = [
{
    year: new Date(2013, 1, 30),
    value: 12
},
{
    year: new Date(2013, 6, 31),
    value: 34
},
{
    year: new Date(2013, 7, 1),
    value: 34
}
];


AmCharts.ready(function () {
    // SERIAL CHART
    chart = new AmCharts.AmSerialChart();
    chart.pathToImages = "../amcharts/images/";
    chart.marginTop = 0;
    chart.marginRight = 0;
    chart.dataProvider = data;
    chart.categoryField = "year";
    chart.zoomOutButton = {
        backgroundColor: '#000000',
        backgroundAlpha: 0.15
    };

    // AXES
    // category
    var categoryAxis = chart.categoryAxis;
    categoryAxis.parseDates = true; // as our data is date-based, we set parseDates to true
    categoryAxis.minPeriod = "DD"; // our data is yearly, so we set minPeriod to YYYY
    categoryAxis.dashLength = 1;
    categoryAxis.axisColor = "#DADADA";

    // value
    var valueAxis = new AmCharts.ValueAxis();
    valueAxis.axisAlpha = 0;
    valueAxis.dashLength = 10;
    valueAxis.inside = true;
    chart.addValueAxis(valueAxis);

    // GRAPH
    graph = new AmCharts.AmGraph();
    graph.lineColor = "#b6d278";
    graph.negativeLineColor = "#487dac"; // this line makes the graph to change color when it drops below 0
    graph.bullet = "round";
    graph.bulletSize = 5;
    graph.connect = false; // this makes the graph not to connect data points if data is missing
    graph.lineThickness = 2;
    graph.valueField = "value";
    chart.addGraph(graph);
    
    // CURSOR  
    var chartCursor = new AmCharts.ChartCursor();
    chartCursor.cursorAlpha = 0;
    chartCursor.cursorPosition = "mouse";
    chartCursor.categoryBalloonDateFormat = "MM月DD日";
    chart.addChartCursor(chartCursor);

    // WRITE
    chart.write("chartdiv");
});

$(document).ready(function(){
	$feifeicms.show.table();
});
</script>
</head>
<body class="body">
<form action="?s=Admin-Client-Overview" method="post" name="myform" id="myform">
<table border="0" cellpadding="0" cellspacing="0" class="table">
  	<tr>
		<td class="tr ct" style="height: 40px">
		<!-- 
		<input type="button" value="所有" class="submit" onClick="changeurl('','','','','');">
		<input type="button" value="最近三天" class="submit" onClick="changeurl('','','','',2);">
		<input type="button" value="最近一周" class="submit" onClick="changeurl('','','','',1);">
		<input type="button" id="continu" value="最近一月" class="submit">
		 -->
		<input type="text" name="start" value="{$start}" id="start" class="datepicker" onclick="WdatePicker({dateFmt:'yyyyMMdd'})"/>
		<input type="text" name="end" value="{$end}" id="end" class="datepicker" onclick="WdatePicker({dateFmt:'yyyyMMdd'})"/>
		<input type="button" value="搜索" class="submit" onclick="post('?s=Admin-Client-Overview');"/>
		</td>
	</tr>
</table>
</form>
<?php
usort($data,'sortByDate');
function sortByDate($a,$b){
	return compareDate($a['date'],$b['date']);
}
function compareDate($d1,$d2){
	if(date("Y-m-d",strtotime($d1))>date("Y-m-d",strtotime($d2))){
		return -1;
	}else{
		return 1;
	}
	return 0;
}
?>
<table border="0" cellpadding="0" cellspacing="0" class="table">
  <thead>
  	<tr class="ct">
      <th>日期</th>
      <th>安装</th>
      <th>卸载</th>
      <th>报活</th>
    </tr>
  </thead>
  <volist name="data" id="d" key="k">
  <tbody>
  <tr>
    <td class="l pd">{$d.date}</td>
    <td class="l pd">{$d.ic|showCount}</td>
    <td class="l pd">{$d.uc|showCount}</td>
    <td class="l pd">{$d.lc|showCount}</td>
  </tr>
  </tbody>
  </volist>
  <tbody>
  <tr>
    <td class="l pd">汇总(去重)</td>
    <td class="l pd">{$install}</td>
    <td class="l pd">{$uninstall}</td>
    <td class="l pd">{$alive}</td>
  </tr>
  </tbody>
</table>
</body>
</html>
